import React, { Component } from 'react';
import { index_nav } from '../../utils/api'

class CateList extends Component {
    state = {
        catelist: [],
    }
    componentDidMount() {
        index_nav().then((res) => {
            this.setState({
                catelist: res.data.list
            })
        })
    }
    render() {
        return (
            <div className='catelist'>
                {
                    this.state.catelist.map((item, index) => {
                        return (
                            <div className='cates' key={index}>
                                <img src={item.pic} />
                                <div className='name'>{item.name}</div>
                            </div>
                        )
                    })
                }


            </div>

        );
    }
}

export default CateList;